#include "welcomewidget.h"
#include "ui_welcomewidget.h"
#include <QPainter>
#include <QPixmap>
#include <QApplication>
#include "gamewidget.h"

WelcomeWidget::WelcomeWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::WelcomeWidget)
{
    ui->setupUi(this);
}

WelcomeWidget::~WelcomeWidget()
{
    delete ui;
}

void WelcomeWidget::paintEvent(QPaintEvent *event){
    QPainter painter(this);
    QPixmap pixmap=QPixmap(":/pic/welcome.png").scaled(size());
    painter.drawPixmap(0,0,pixmap);
}

void WelcomeWidget::on_exitGame_clicked()
{
    QApplication::exit();
}

void WelcomeWidget::on_startBtn_clicked()
{
    game.showMaximized();
}

void WelcomeWidget::closeEvent(QCloseEvent *event){
    QApplication::exit(0);
}
